public class FfindNumberIn2DArray {

    public static boolean getNumber(int[][] numbers,int number){
        if(numbers==null||numbers.length<=0||numbers[0].length<=0){
            return false;
        }
        int rows=numbers.length-1;
        int cloms=numbers[0].length-1;
        int row=0;
        int clom=cloms;
        while (row<=rows&&clom>=0){
            if(number==numbers[row][clom]){
                return true;
            }else if(number>numbers[row][clom]){
                row++;
            }else if(number<numbers[row][clom]){
                clom--;
            }
        }
        return false;
    }

    public static void main(String[] args) {
        int[][] numbers={{-5}};
        System.out.println(getNumber(numbers,-5));
    }
}


